<!-- 公告栏卡片 -->
<div class="card-widget card-announcement">
    <div class="card-content">
        <div class="item-headline">
            <i class="haofont hao-icon-bullhorn"></i>
            <span th:text="${theme.config.sidebar.announcement.title ?: '站点公告'}">站点公告</span>
        </div>
        <div class="announcement-content" th:utext="${theme.config.sidebar.announcement.content ?: '欢迎访问本站！'}">
            欢迎访问本站！
        </div>
        
        <!-- 如果配置了链接按钮（仅在启用时渲染） -->
        <div class="announcement-actions" th:if="${theme.config.sidebar.announcement.showButton == true}">
            <a class="announcement-btn" 
               th:href="${theme.config.sidebar.announcement.buttonUrl ?: '#'}"
               th:text="${theme.config.sidebar.announcement.buttonText ?: '了解更多'}"
               target="_blank">
                了解更多
            </a>
        </div>
    </div>
</div>

<!-- 内联样式 - 自适应版 -->
<style>
.card-announcement {
    background: linear-gradient(135deg, rgba(255, 245, 235, 0.9) 0%, rgba(255, 230, 200, 0.85) 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(255, 140, 0, 0.15);
    transition: all 0.3s ease;
    border-left: 4px solid #ff8c00;
    /* 强制覆盖全局 min-height，实现完全自适应 */
    min-height: auto !important;
    height: auto !important;
}

.card-announcement:hover {
    box-shadow: 0 6px 28px rgba(255, 140, 0, 0.25);
    transform: translateY(-2px);
}

.card-announcement .card-content {
    padding: 0.85rem 0.8rem 0.85rem 0.8rem;
}

.card-announcement .item-headline {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ff8c00;
    margin: 0 0 0.6rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 140, 0, 0.2);
}

.card-announcement .item-headline i {
    font-size: 1rem;
    margin-right: 0.45rem;
    animation: bellRing 2s ease-in-out infinite;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(-10deg); }
    20%, 40% { transform: rotate(10deg); }
    50% { transform: rotate(0deg); }
}

.card-announcement .announcement-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #5a3a1a;
    margin: 0;
    padding: 0;
}

.card-announcement .announcement-content p {
    margin: 0 0 0.4rem 0;
    padding: 0;
}

.card-announcement .announcement-content p:first-child {
    margin-top: 0;
}

.card-announcement .announcement-content p:last-child {
    margin-bottom: 0;
}

.card-announcement .announcement-content strong {
    color: #ff8c00;
    font-weight: 600;
}

.card-announcement .announcement-content a {
    color: #ff8c00;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.card-announcement .announcement-content a:hover {
    color: #ff6600;
}

.card-announcement .announcement-actions {
    display: flex;
    justify-content: center;
    margin-top: 0.7rem;
}

.card-announcement .announcement-btn {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    background: linear-gradient(135deg, #ff8c00 0%, #ff6600 100%);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 18px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3);
}

.card-announcement .announcement-btn:hover {
    background: linear-gradient(135deg, #ff6600 0%, #ff4500 100%);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.5);
    transform: translateY(-2px);
    color: #fff;
}

/* 深色模式适配 */
[data-theme="dark"] .card-announcement {
    background: linear-gradient(135deg, rgba(40, 30, 20, 0.9) 0%, rgba(60, 40, 20, 0.85) 100%);
    border-left-color: #ffb347;
}

[data-theme="dark"] .card-announcement .item-headline {
    color: #ffb347;
    border-bottom-color: rgba(255, 179, 71, 0.2);
}

[data-theme="dark"] .card-announcement .announcement-content {
    color: #d4b89a;
}

[data-theme="dark"] .card-announcement .announcement-content strong {
    color: #ffb347;
}

[data-theme="dark"] .card-announcement .announcement-content a {
    color: #ffb347;
}

[data-theme="dark"] .card-announcement .announcement-content a:hover {
    color: #ffc875;
}

[data-theme="dark"] .card-announcement .announcement-btn {
    background: linear-gradient(135deg, #ffb347 0%, #ff9933 100%);
}

[data-theme="dark"] .card-announcement .announcement-btn:hover {
    background: linear-gradient(135deg, #ff9933 0%, #ff8800 100%);
}

/* 响应式 */
@media (max-width: 768px) {
    .card-announcement .card-content {
        padding: 0.8rem 0.7rem 0.8rem 0.7rem;
    }
    
    .card-announcement .announcement-content {
        font-size: 0.8rem;
        line-height: 1.55;
    }
    
    .card-announcement .announcement-content p {
        margin: 0 0 0.35rem 0;
    }
    
    .card-announcement .item-headline {
        font-size: 0.9rem;
        margin: 0 0 0.55rem 0;
        padding-bottom: 0.45rem;
    }
    
    .card-announcement .announcement-btn {
        font-size: 0.75rem;
        padding: 0.4rem 1rem;
    }
}
</style>

